<template>
	<view class="bottom-nav">
		<!-- 底部占位 -->
		<view class="uni-tab__seat" />
		<view class="uni-tab__cart-box flex">
			<view class="flex uni-tab__cart-sub-box">
				<view v-for="(item,index) in options" :key="index" class="flex uni-tab__cart-button-left uni-tab__shop-cart" @click="onClick(index,item)">
					<view class="uni-tab__icon">
						<!-- <image :class="item.icon" :src="item.icon" mode="widthFix" /> -->
						<view :class="item.icon"  hover-class="red"></view>
					</view>
					<text class="uni-tab__text" hover-class="red">{{ item.text }}</text>
					<!-- <view class="flex uni-tab__dot-box">
						<text v-if="item.info" :class="{ 'uni-tab__dots': item.info > 9 }" class="uni-tab__dot ">{{ item.info }}</text>
					</view> -->
				</view>
			</view>
			<!-- <view :class="{'uni-tab__right':fill}" class="flex uni-tab__cart-sub-box ">
				<view v-for="(item,index) in buttonGroup" :key="index" :style="{backgroundColor:item.backgroundColor,color:item.color}" class="flex uni-tab__cart-button-right" @click="buttonClick(index,item)"><text class="uni-tab__cart-button-right-text">{{ item.text }}</text></view>

			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		name: 'BottomNav',
		props: {
			options: {
				type: Array,
				default () {
					return [{
						icon: 'msfont ms-fenpei',
						text: '店铺'
					}, {
						icon: 'msfont ms-jiaofei',
						text: '购物车'
					}]
				}
			},
			// fill: {
			// 	type: Boolean,
			// 	default: false
			// }
		},
		methods: {
			onClick(index, item) {
				this.$emit('click', {
					index,
					content: item
				})
			},
			buttonClick(index, item) {
				if (uni.report) {
					uni.report(item.text, item.text)
				}
				this.$emit('buttonClick', {
					index,
					content: item
				})
			}
		}
	}
</script>

<style scoped>
	.flex {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
	}

	.bottom-nav {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		flex-direction: row;
		/* border: 2rpx solid #CFCFCF; */
		/* border-radius: 15rpx; */
		height: 120rpx;
		overflow: hidden;
	}

	.uni-tab__cart-box {
		flex: 1;
		height: 120rpx;
		background-color: #fff;
		z-index: 900;
	}

	.uni-tab__cart-sub-box {
		flex: 1;
	}

	.uni-tab__right {
		margin: 10rpx 0;
		margin-right: 20rpx;
		border-radius: 200rpx;
		overflow: hidden;
	}

	.uni-tab__cart-button-left {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		position: relative;
		justify-content: center;
		align-items: center;
		flex-direction: column;
	}
	.uni-tab__shop-cart:last-child .uni-tab__icon{
			/* margin-left: -7px; */
	}
	.uni-tab__icon {
		width: 40rpx;
		height: 40rpx;
		color: #000;
	}

	.image {
		width: 40rpx;
		height: 40rpx;
	}

	.uni-tab__text {
		margin-left: -8rpx;
		margin-top: 6rpx;
		font-size: 28rpx;
		color: #000;
	}
	.red{
		color: #FF2A2A;
	}
	.uni-tab__cart-button-right {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		flex: 1;
		justify-content: center;
		align-items: center;
	}

	.uni-tab__cart-button-right-text {
		font-size: 20rpx;
		color: #fff;
	}

	.uni-tab__cart-button-right:active {
		opacity: 0.7;
	}

	.uni-tab__dot-box {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		position: absolute;
		right: 24px;
		top: 8rpx;
		justify-content: center;
		align-items: center;
		/* width: 0;
 */
		/* height: 0;
 */
	}
	.msfont{
		color: #000;
		font-size: 28rpx;
	}

	.uni-tab__dot {
		/* width: 30rpx;
 */
		/* height: 30rpx;
 */
		padding: 0 8rpx;
		line-height: 30rpx;
		color: #ffffff;
		text-align: center;
		font-size: 24rpx;
		background-color: #ff0000;
		border-radius: 30rpx;
	}

	.uni-tab__dots {
		padding: 0 8rpx;
		/* width: auto;
 */
		border-radius: 30rpx;
	}

	.uni-tab__color-y {
		background-color: #ffa200;
	}

	.uni-tab__color-r {
		background-color: #ff0000;
	}
</style>
